Author
Affiliation

David Sneddon

Old Dominion University

Question 1

Gun violence has been a particularly hot topic in the United States over the past few decades. According to the 2017 iteration of the Small Arms Survey, the United States is estimated to have over twice as many firearms per 100,000 people than the second highest country in the world. The introduction of “shall issue” policies, which mandate that authorities must issue concealed carry permits to applicants who meet specific criteria, has sparked considerable debate regarding their potential impact on crime rates. These policies, in contrast to “may issue” policies, remove discretion from authorities when issuing concealed carry permits. Proponents argue that such policies deter criminal activity by increasing the likelihood that potential victims are armed, thereby enhancing public safety. Critics, however, contend that more widespread gun carrying could escalate violence and lead to higher crime rates.

In this question, you will explore the effects these policies had on the violent crime rate, murder rate, and robbery rate. These data (data; documentation) contain data on 50 states, and DC, from 1977 to 1999.

  1. Read the data into a data frame called guns. Turn the law variable into a binary variable equal to one if the state has a “shall issue” policy for that year. (2 Points)
Code
guns <- read.csv("https://vincentarelbundock.github.io/Rdatasets/csv/AER/Guns.csv")
guns$law <- ifelse(guns$law=="yes",1,0)
  1. Create a plot of the number of states with “shall issue” policies by year. Be sure to label the axes, etc. Set your \(Y\)-axis to range from 0 to 51, so as to capture a sense of how prevalent these polices are across all 50 states (plus D.C.). Be sure to label your axes, etc. (3 Points)
Code
par(yaxs = "i")
plot(x = aggregate(guns$law, by=list(guns$year), FUN=sum),
     axes = FALSE,
     type="o",
     xlim = c(1977, 1999),
     ylim = c(0, 51),
     ylab = "Count",
     xlab = "Year",
     las = 1,
     pch = 20,
     col = "tomato",
     main = "Shall Carry Laws: 1977-1999"
     
)

axis(1, at = min(guns$year):max(guns$year), labels = min(guns$year-1900):max(guns$year-1900), cex.axis = 0.75)
axis(2, at = 0:51, labels = seq(0, 51, by = 1), las = 1, cex.axis = 0.75)
box()
Plot

  1. Next, create a plot of the average violent crime rate by year. Be sure to label your axes, etc. (3 Points)
Code
plot(x = aggregate(guns$violent, by=list(guns$year), FUN=mean),
     type="o",
     xlim = c(1977, 1999),
     ylab = "Average Rate",
     xlab = "Year",
     las = 1,
     pch = 20,
     col = "tomato",
     main = "Violent Crime Rates: 1977-1999"
)
Plot

  1. Calculate the violent crime rate by year weighted by population. Since the violent crime rate is just that, a rate, it could make sense to increase the weight placed on rates impacting more people. In other words, to get a true picture of the violent crime rate faced by the average American, it would not make sense to consider the violent crime rates in California and Delaware equally. Create a plot displaying both the equally weighted and population weighted violent crime rates over time. Include a legend to differentiate between the two time series. Be sure to label your axes, etc. (6 Points)
Code
wt_mean <- function(a, b) {
  sum(a * b)/sum(b)
} 
viol_year <- data.frame()
for (i in guns$year){
  viol_year[as.character(i),1] <- wt_mean(guns$violent[guns$year==i], guns$population[guns$year==i])
}

viol_year$year <- row.names(viol_year)
plot(x = unlist(viol_year[2]),
     y = unlist(viol_year[1]),
     type="o",
     xlim = c(1977, 1999),
     ylim = c(400, 800),
     ylab = "Average Rate",
     xlab = "Year",
     las = 1,
     pch = 20,
     col = "royalblue",
     main = "Violent Crime Rates: 1977-1999"
)



lines(x = aggregate(guns$violent, by=list(guns$year), FUN=mean),
      type="o",
      col= "tomato",
      pch = 20)

legend("topleft", 
       legend = c("Unweighted","Weighted by Pop."),
       bty = "n",
       col = c("tomato","royalblue"),
       pch = 16,
       cex = 0.75)
Plot

  1. Estimate a simple model explaining log(violent) with only the indicator for whether the state has implemented a “shall issue” policy. Use heteroskedasticity robust standard errors. Display the coefficients (using summary() is fine) and interpret the coefficient. (4 Points)
Code
reg1 <- lm(log(violent) ~ law, data = guns)
summary(reg1)
Output

Call:
lm(formula = log(violent) ~ law, data = guns)

Residuals:
     Min       1Q   Median       3Q      Max 
-2.28477 -0.42748  0.04655  0.42172  1.84504 

Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  6.13492    0.02072  296.13   <2e-16 ***
law         -0.44296    0.04203  -10.54   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.6174 on 1171 degrees of freedom
Multiple R-squared:  0.08664,   Adjusted R-squared:  0.08586 
F-statistic: 111.1 on 1 and 1171 DF,  p-value: < 2.2e-16

This is a simple regression of:
\[ log(\text{Violent}_i)=\beta_0 + \beta_1\text{Law}_i + \varepsilon_i \] Such That:

\(\text{Violent}\) : Violent crime rate for an observation \(i\).
\(\text{Law}\) : A binary variable for whether a “Shall Issue” law was in force for an observation \(i\).
\(i\) : Observation of a state in a given year.

Interpretation:

\(\beta_0\) : Natural logarithm of violent crime rate expected with no “Shall Issue” law in place, true rate can be extrapolated by \(e^{\beta_0}\).

\[ e^{6.13492} = 461.702 \] \(\beta_1\) : Predicted percent change in violent crime rate should a “Shall Issue” law be in place : \(-44.296\%\)
\(\varepsilon\) : Error term.

  1. Add male, log(income), and log(density) into the model. Include state and year fixed effects as well. Display the coefficients (using summary() is fine). How does the “shall issue” coefficient change? Discuss if the signs of the other coefficients surprise you or if they conform to your expectations. What are the fixed effects doing? (6 Points)
Code
library(fixest)
reg2 <- feols(log(violent) ~ law + log(income) + log(density) | state + year, 
              data = guns, vcov = "hetero")
summary(reg2)
Output
OLS estimation, Dep. Var.: log(violent)
Observations: 1,173
Fixed-effects: state: 51,  year: 23
Standard-errors: Heteroskedasticity-robust 
              Estimate Std. Error   t value  Pr(>|t|)    
law           0.012757   0.019202  0.664352 0.5066046    
log(income)   0.337107   0.113232  2.977149 0.0029733 ** 
log(density) -0.222717   0.069317 -3.213039 0.0013516 ** 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
RMSE: 0.137502     Adj. R2: 0.951509
                 Within R2: 0.02257 

This yields the regression:

\[ log(\text{Violent}_{it}) = \beta_0 + \beta_1\text{Law}_{it} + \beta_2log(\text{Income}_{it})+\beta_3log(\text{Density}_{it})+\zeta_i+\gamma_t+\varepsilon_{it} \]

Such that:

\(\text{Violent}\) : Violent crime rate (incidents per 100,000 members of the population
\(\text{Law}\) : A binary variable for whether a “Shall Issue” law was in force.
\(\text{Income}\) : Real per capita personal income.
\(\text{Density}\) : Population per square mile of land area, divided by 1,000.
\(\zeta_i\) : Fixed effects term for state.
\(\gamma_t\) : Fixed effects term for year.
\(i\) = A given state.
\(t\) = A given year.
\(\varepsilon\) = Error term robust to heteroscedasticity.

\(\beta_0\) : No meaningful interpretation \(\beta_1\) : With the addition of fixed effects and the \(\text{Income}\) and \(\text{Density}\) regressors, \(\text{Law}\) now predicts a \(1.276\%\) increase in the violent crime rate although we now fail to reject the null hypothesis for at \(\alpha=0.1\) and is therefore not statistically significant.
\(\beta_2\) : There is evidence to reject the null hypothesis (\(\alpha=0.01\)) and the prediction is that a \(1\%\) increase in \(\text{Income}\) will result in a \(33.711\%\) increase in the violent crime rate.
\(\beta_3\) : There is evidence to reject the null hypothesis (\(\alpha=0.01\)) and the prediction is that a \(1\%\) increase in \(\text{Density}\) will result in a \(-22.272\%\) change in violent crime.

  1. Just like how we can calculate weighted averages like in an earlier question, we can also estimate weighted regressions. Include weights = ~population into your feols() code and estimate the mode. Display the coefficients (using summary() is fine). How do the coefficients change, paying special attention to the “shall issue” coefficient? (4 Points)
Code
reg3 <- feols(log(violent) ~ law + log(income) + log(density) | state + year, 
              data = guns, vcov = "hetero", weights = ~population)
summary(reg3)
Output
OLS estimation, Dep. Var.: log(violent)
Observations: 1,173
Weights: population
Fixed-effects: state: 51,  year: 23
Standard-errors: Heteroskedasticity-robust 
              Estimate Std. Error   t value   Pr(>|t|)    
law           0.085182   0.017784  4.789877 1.8977e-06 ***
log(income)   0.211513   0.108147  1.955798 5.0742e-02 .  
log(density) -0.048066   0.078346 -0.613505 5.3967e-01    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
RMSE: 0.236687     Adj. R2: 0.947982
                 Within R2: 0.041656

When applying a weight transformation \(\text{Law}\) is now highly significant with \(\alpha=0.001\) and a “Shall Issue” law is expected to increase violent crime by \(8.518\%\). Income remains statistically significant albeit although there is limited evidence with \(\alpha=0.1\). We fail to reject the null hypothesis for population density. The model is robust to heteroscedacticity.

  1. What is another variable not provided in the dataset that you wish you could incorporate into this model? How would you imagine the “shall issue” coefficient to change and why? Use an econometric argument to support your claim. (2 Points)

I’d like to see measures of income inequality in the analysis. The statistical significance of per-capita income having a positive effect on violent crime rates suggests an omitted variable bias where extremely high levels of income may skew the results. There is no theoretical upper limit to income while there is a lower bound of \(0\) across all states and at all times.

Question 2

Write a little bit about how your project is going (yes, you may vent a little…). What are you finding most time consuming? What has been most challenging? Be honest with yourself: is there anything you can be doing better? This one might be dangerous to ask, but are you enjoying your project? (20 Points)

I’m fairly pleased with how my project is going. I just wish I had more time to work on it. Every one of these modules I work through gives me more to consider and at the same time it is frustrating because when I thought I had an element fairly well locked down, I find a new technique that I can apply that requires some re-write. For instance, you mentioned in my last feedback that I would like fixest, and you’re right, however I also know I’m going to have to redo my regressions because now I’m going to have to use it.

Question 3

Fill out the course evaluation and include a screenshot as evidence. To include a screenshot, first place the image file in the same folder as your Homework 5.1 Template. Next, paste the file name, including the file’s extension (.png, .jpg, etc.), inside the the parentheses below. (5 Bonus Points) Note: evaluations are anonymous (and ultimately optional), so I am not looking to see what you wrote, just some confirmation that you have completed the survey. Also, evaluations are necessarily optional, which is why this question is for extra credit. (Another) Note: you may also leave any non-anonymous thoughts, opinions, suggestions, etc. about the course here as well if you’d like.

I’ve completed all my surveys, so there are no more pending